package com.spbl.common.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * Description(返回基类)
 * author: Gao xueyong
 * Create at: 2020/4/19 9:08 下午
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> implements Serializable {
    private String status;
    private Integer code;
    private String msg;
    private T data;

    public static Result renderError(Integer code,String msg){
        return new Result(ResultCode.ERROR,code,msg,null);
    }
    public static Result renderError(Integer code,String msg,Object retObj){
        return new Result(ResultCode.ERROR,code,msg,retObj);
    }
    public static Result renderSuccess(Integer code,String msg){
        return new Result(ResultCode.SUCCESS,code,msg,null);
    }
    public static Result renderSuccess(Integer code,String msg,Object retObj){
        return new Result(ResultCode.SUCCESS,code,msg,retObj);
    }

}
